import { IFeidaoAiBrowserComponent } from '@dfeidao/atom-web/interfaces';
// import get from '@dfeidao/atom-web/local/get';
// import remove from '@dfeidao/atom-web/local/remove';
import render from '@dfeidao/atom-web/render/render';
import p002 from './p002';
// 查询
export default async function a004(fd: IFeidaoAiBrowserComponent) {
	const name_inp = fd.data.node.querySelector('#shuxingzhi') as HTMLInputElement;
	const name = name_inp.value;

	const div_nodes = fd.data.node.querySelectorAll<HTMLDivElement>('[data-alert_list]');
	const p2 = fd.data.node.querySelector<HTMLDivElement>('[data-feidao-presentation="p002"]');
	const arr = new Array();
	const ins = 0;
	Array.from(div_nodes).forEach((v) => {
		const comtact = v.getAttribute('data-feidao-no');
		if (comtact.indexOf(name) === -1) {
			arr.push(ins);

			v.classList.remove('display-n');
			v.closest('[data-alert_list]').classList.add('display-n');
		} else {
			v.classList.add('display-n');
			v.closest('[data-alert_list]').classList.remove('display-n');
		}
	});

	if (arr.length === div_nodes.length) {
		render(fd, '', p002, 'p002', 'inner');
		p2.classList.remove('display-n');
	} else {
		p2.classList.add('display-n');
	}
	// remove(fd, 'field');
	// remove(fd, 'fieldtitle');

}
